package proxy.general;

import java.lang.reflect.*;

/**
 * @Author：LJ
 * @Description：
 * @Date: 2017/11/27
 * @Modified By:
 */
public class Client {

    public static void main(String[] args) {
        Subject subject = new RealSubject();
        InvocationHandler handler = new ProxyInvocationHandler(subject);
        Subject proxySubject = (Subject) java.lang.reflect.Proxy.newProxyInstance(subject.getClass().getClassLoader(), new Class[]{Subject.class}, handler);
        proxySubject.doSomething();

        Subject tem =SubjectDynamicProxy.newProxyInstance(subject);
        tem.doSomething();
    }

}
